<%@page import="java.rmi.RemoteException"%>
<%@page import="java.sql.SQLException"%>
<%@page import="exception.TopicNotFoundException"%>
<%@page import="exception.ForumNotFoundException"%>
<%@page import="exception.PostNotExistException"%>
<%@page import="exception.NotLoggedInException"%>
<%@ include file="serverConnection.jsp" %>
<%

try
{
	String userName = (String)session.getAttribute("userName");
	String password = (String)session.getAttribute("password");
	int forumId = (Integer)session.getAttribute("forumId");
	int topicId = (Integer)session.getAttribute("topicId");
	int postId = Integer.parseInt(request.getParameter("postId"));
	
	forum.removePost(userName,password,forumId,topicId,postId);
	
	
	
}
catch(NotLoggedInException e)
{
	response.sendRedirect("loggin.jsp");
	response.flushBuffer();
	return;
}

catch (PostNotExistException pne){}
catch(ForumNotFoundException fne){}
catch(TopicNotFoundException tne){}


catch(SQLException s){
	   
	   
	   response.sendError(response.SC_INTERNAL_SERVER_ERROR,
		"SQL server is down");
	
		response.flushBuffer();
		return;
	   
	   
}
catch(RemoteException u){
	   
	   response.sendError(response.SC_INTERNAL_SERVER_ERROR,
		"forum server is down");
	
		response.flushBuffer();
		return;
}


finally
{
	 response.sendError(response.SC_INTERNAL_SERVER_ERROR,"problem");
	  response.flushBuffer();
	  return;
}


%>